<template>
  <div class="container-content">
    <el-form
      ref="formRef"
      :model="kingBomEntity"
      label-width="90px"
      label-position="left"
    >
     
      <div class="desc-title">安全库存清单</div>
      <el-table
        :data="kingBomEntity.warehouseMaxMinInventoryEntity"
        style="width: 100%"
        highlight-current-row
        border
        :key="flag"
      >
        <template #empty
          ><el-button plain type="primary" round @click="addNewRow"
            >添加新行</el-button
          ></template
        >
        <el-table-column label="操作" width="120px">
          <template slot-scope="scope">
            <el-button
              plain
              icon="el-icon-plus"
              size="small"
              @click="handleDataAdd(scope.$index, scope.row)"
            ></el-button>
            <el-button
              plain
              icon="el-icon-minus"
              size="small"
              @click="handleDataDelete(scope.$index, scope.row)"
            ></el-button>
          </template>
        </el-table-column>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column label="仓库"  align="center">
          <template slot-scope="scope">
            <el-form-item label-width="0px" style="margin: 0">
              <el-input
                v-model="scope.row.warehouseName"
              >
                <i
                slot="suffix"
                class="el-icon-search"
                @click="openList('仓库', scope.$index)"
              ></i>
              </el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="物料编码"  align="center">
          <template slot-scope="scope">
         <el-form-item label-width="0px" style="margin: 0">
              <el-input
                v-model="scope.row.materialCode"
              >
                <i
                slot="suffix"
                class="el-icon-search"
                @click="openList('物料编码', scope.$index)"
              ></i>
              </el-input>
            </el-form-item>
          </template>
        </el-table-column>
        <el-table-column label="物料名称" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.materialName" disabled></el-input>
          </template>
        </el-table-column>
        <el-table-column label="基本单位"  align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.baseUnit" disabled></el-input>
          </template>
        </el-table-column>
        <el-table-column label="最小库存"  align="center">
          <template slot-scope="scope">
             <el-input v-model="scope.row.minInventory"></el-input>
          </template>
        </el-table-column>
        <el-table-column
          label="安全库存"
        
          align="center"
        >
          <template slot-scope="scope">
            <el-input v-model="scope.row.safeInventory"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="在订货点" align="center">
          <template slot-scope="scope">
             <el-input v-model="scope.row.reorderPoint"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="经济订货批量"  align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.economicOrderNum"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="最大库存"  align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.maxInventory"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="备注"  align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.remark"></el-input>
          </template>
        </el-table-column>
      </el-table>
    </el-form>
  </div>
</template>
<script>
import {
MaxMinInventory
} from "@/api/bim/bim";
export default {
  data() {
    return {
    
      dialogTableVisible: false,
      title: "",
      list: true,
      num: 0,
      count: 0,
      flag: 0,
      kingBomEntity: {
        warehouseMaxMinInventoryEntity: [],
        
      },
      dataList: [],
      gridData: [],
    };
  },
  methods: {
    handleDataAdd() {
      if (this.kingBomEntity.warehouseMaxMinInventoryEntity == undefined) {
        this.kingBomEntity.warehouseMaxMinInventoryEntity = [];
      }
      let outher = {
        bomId: "",
        childBomVersion: "",
        childMaterialCode: "",
        childMaterialName: "",
        childType: "",
        childUnitCode: "",
        createBy: "",
        createTime: "",
        fixedLoss: "",
        id: "",
        pageNo: 0,
        pageSize: 0,
        params: {},
        remark: "",
        remarks: "",
        searchValue: "",
        sendDeptCode: "",
        sendWarehouseCode: "",
        supplyDeptCode: "",
        supplyType: "",
        updateBy: "",
        updateTime: "",
        usageDenominator: "",
        usageNumerator: "",
        usageType: "",
        varLossRate: "",
      };
      this.kingBomEntity.warehouseMaxMinInventoryEntity.push(outher);
    },

  },
  created() {
    this.selectProject();
    // console.log(this.listid);
   MaxMinInventory(this.listid).then((res)=>{
    if (res.code==200) {
        this.kingBomEntity=res.data
    }
   })
  },
};
</script>
<style lang="scss" scoped>
.divider {
  margin: 0;
}
.el-icon-search {
  margin-top: 70% !important;
}
</style>
